Skip to content

Instantly share code, notes, and snippets.

var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@dev-niiaddy
dev-niiaddy / QRPainter.kt
Last active May 13, 2024 10:47
A function to encode text as a QR code using BitmapPainter and zxing-core for use in jetpack compose with Image composable.
@Composable
fun rememberQrBitmapPainter(
content: String,
size: Dp = 150.dp,
padding: Dp = 0.dp
): BitmapPainter {
val density = LocalDensity.current
val sizePx = with(density) { size.roundToPx() }
val paddingPx = with(density) { padding.roundToPx() }
@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@mikeananev
mikeananev / scratch_2.txt
Created May 3, 2021 07:50
MacOS mc Midnight commander open jar file
# jar
shell/i/.jar
Open=%cd %p/uzip://
View=%view{ascii} /usr/local/Cellar/midnight-commander/4.8.26/libexec/mc/ext.d/archive.sh view zip
# jar
type/i/^jar\ archive
Open=%cd %p/uzip://
View=%view{ascii} /usr/local/Cellar/midnight-commander/4.8.26/libexec/mc/ext.d/archive.sh view zip
import { useEffect, useState } from "react"
import { motion } from "framer-motion"
import { addPropertyControls, ControlType } from "framer"
import Masonry, { ResponsiveMasonry } from "react-responsive-masonry"
import React from "react"
// Welcome to Code in Framer
// Get Started: https://www.framer.com/docs/guides/
/**
@kentbrew
kentbrew / lang_chrome_osx.md
Last active May 13, 2024 10:40
How to change the Chrome default language on OSX

How to Change your Chrome Default Language

Open up a Terminal window. (If you have never seen Terminal before, go to Spotlight Search and type "Terminal.")

In the Terminal box, try this:

defaults read com.google.Chrome AppleLanguages

If you see this:

@royling
royling / background.js
Last active May 13, 2024 10:39
Click Chrome extension icon to execute scripts on active tab
chrome.action.onClicked.addListener((tab) => {
chrome.scripting.executeScript({
target: {
tabId: tab.id,
},
files: ["content.js"],
});
});
@Acephalia
Acephalia / wpcitwebp.php
Last active May 13, 2024 10:39
Wordpress Convert Image To WebP and Delete Original File On Upload
//Convert uploaded files to webp and delete uploaded file. Imagick needs to be enabled. This can be done via the php config settings in your servers control panel.
function compress_and_convert_images_to_webp($file) {
// Check if file type is supported
$supported_types = ['image/jpeg', 'image/jpg', 'image/png', 'image/webp'];
if (!in_array($file['type'], $supported_types)) {
return $file;
}
// Get the path to the upload directory
@Geczy
Geczy / migrate.sh
Last active May 13, 2024 10:37
Migrate Coolify to a new server
#!/bin/bash
# This script will backup your Coolify instance and move everything to a new server. Docker volumes, Coolify database, and ssh keys
# 1. Script must run on the source server
# 2. Have all the containers running that you want to migrate
# Configuration - Modify as needed
sshKeyPath="$HOME/.ssh/your_private_key" # Key to destination server
destinationHost="server.example.com"
@UnaNancyOwen
UnaNancyOwen / CMakeLists.txt
Last active May 13, 2024 10:36
Drawing Point Cloud retrieve from Velodyne VLP-16
cmake_minimum_required( VERSION 2.8 )
# Create Project
project( solution )
add_executable( project main.cpp )
# Set StartUp Project (Option)
# (This setting is able to enable by using CMake 3.6.0 RC1 or later.)
set_property( DIRECTORY PROPERTY VS_STARTUP_PROJECT "project" )